﻿using System.Collections.Generic;

namespace Sustainalytics.ScreeningTool.Synchronization
{
    public static class HashSetExtensions
    {
        public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null)
            => new HashSet<T>(source, comparer);

        public static HashSet<T> AddItems<T>(this HashSet<T> source, IEnumerable<T> items)
        {
            foreach (var item in items)
            {
                source.Add(item);
            }

            return source;
        }
    }
}
